package myPack.GMAO.Bean;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import myPack.GMAO.Entity.Service;
import myPack.GMAO.Interface.ServiceInterface;


@Stateless(mappedName="service")
public class ServiceBean implements ServiceInterface 
{
	
	@PersistenceContext
	EntityManager em;
	 
	@Override
	public void Ajouter(Service s) 
	{
		em.persist(s);
	}
	@Override
	public Service Chercher(int idS) 
	{
		return em.find(Service.class, idS);
	}
	@Override
	public List<Service> Lister() 
	{
		return em.createQuery("from Service").getResultList();
	}
	@Override
	public void Supprimer(int idS) 
	{
		em.remove(em.find(Service.class, idS));
	}
}
